package com.hyf.translucentstatusbar.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;

import com.hyf.translucentstatusbar.base.OnScrollListener;

/**
 * Created by Administrator on 2017/9/14.
 */

public class ScrollListenerScrollView extends ScrollView {
    public ScrollListenerScrollView(Context context) {
        super(context);
    }

    public ScrollListenerScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ScrollListenerScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    private OnScrollListener mScrollListener;

    public void setScrollListener(OnScrollListener scrollListener) {
        mScrollListener = scrollListener;
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        if (mScrollListener != null) {
            mScrollListener.onScrollChange(t);
        }
    }
}
